﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BacteriaSimulation.Simulation
{
    public class GoRoundStrategy : BacteriumSimulationStrategy
    {
        public override void PerformStrategy(Bacterium bacterium, SimulationEnvironment env)
        {
            double leftPerpendicularXComponent = -1 * bacterium.Speed.YComponent;
            double leftPerpendicularYComponent = bacterium.Speed.XComponent;

            bacterium.AccelerationDirection = new UnitVector2D(leftPerpendicularXComponent, leftPerpendicularYComponent);
        }

        public override void WallCollisionDetected(Bacterium bacterium, WALL_COLLISION_TYPE collisionType, SimulationEnvironment env)
        {
            switch (collisionType)
            {
                case WALL_COLLISION_TYPE.BOTTOM:
                    {
                        bacterium.Speed.YComponent *= -1;
                        break;
                    }
                case WALL_COLLISION_TYPE.RIGHT:
                    {
                        bacterium.Speed.XComponent *= -1;
                        break;
                    }
                case WALL_COLLISION_TYPE.TOP:
                    {
                        bacterium.Speed.YComponent *= -1;
                        break;
                    }
                case WALL_COLLISION_TYPE.LEFT:
                    {
                        bacterium.Speed.XComponent *= -1;
                        break;
                    }
            }
        }

        public override void BacteriumCollisionDetected(Bacterium bacterium, Bacterium collidedBacterium, SimulationEnvironment env)
        {

        }
    }
}
